<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 用户输入数字，赋予变量num
      const num1 = +prompt('输入一个数')
      function sanwu(num){
              // 定义数组容器
      let arr = []
      // for循环打印1到num的数字，存入数组arr
      for (let i = 1; i <= num; i++) {
        arr.push(i)
      }
      // console.log(arr)
      // 判断他是否是三，五的北山倍数
      for (let i = 0; i <= arr.length-1; i++) {
        if (arr[i] % 3 === 0 && arr[i] % 5 === 0) {
          arr[i] = '三五'
        } else if(arr[i] % 5 ===0){
          arr[i] = '五'
        } else if(arr[i] % 3 ===0){
          arr[i] = '三'
        }
      }
      // console.log(arr);
      return arr
      }
      console.log(sanwu(num1));
    </script>
  </body>
</html>
